import MyButton from './MyButton.vue'
import MyInput from './MyInput.vue'

const componentPool = [
	MyButton,
	MyInput
]


export default {
	install(app, options) {
		console.log(options);//components: ["1", "2"]
		// 直接加载全部
		// componentPool.map((comp) => {
		// 	app.component(comp.name, comp)
		// })

		// 通过注册表 实现按需加载
		if (options.components) {
			options.components.map((compName) => {
				componentPool.map((comp) => {
					if(compName === comp.name){
						app.component(comp.name, comp)
					}
				})
			})
		} else {
			componentPool.map((comp) => {
				app.component(comp.name, comp)
			})
		}
	}
}